<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

//基本路由器
Route::get('/hello', function () {
    return url("aa");//生成地址
});
//文件上传
Route::get('/upload', function () {
    return view("upload");
});


//带参数的路由
Route::get("/hello/{id}",function($id){
	return "参数路由ID".$id;
});

//可选参数路由
Route::get("/demo/{id?}",function($id=0){
	return "可选参数路由ID".$id;
});

//命名路由
Route::get('/demo1',['as' =>'perfile',function(){
	return url("profile");
}]);

//通过URl 访问控制和方法
Route::get("/photo","photoController@index");

//连接数据库
Route::get("/photo/getlist","photoController@getlist");
Route::get("/photo/getlist","photoController@getlist");


Route::get("/new/delete/{id}","NewController@delete");
//响应信息
Route::get("/response","photoController@response");
//文件上传
Route::post("doupload","PhotoController@doUpload");

//资源路由
Route::resource('new','NewController');



//资源路由2
Route::resource('art','ArticleController');

/*
 * art  -> ArticleController@index
 * art/12  -> ArticleController@show
 * art/12/edit  -> ArticleController@edit
 *
 * post
 * art  -> ArticleController@store
 *
 * put
 * art/12  -> ArticleController@update
 * delete
 * art/12  -> ArticleController@destroy
 */
